/*     */ package com.lmpop.trade.tb_unionmodelinfo;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.text.DecimalFormat;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Tb_unionmodelinfoInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Tb_unionmodelinfoInfo()
/*     */   {
/*  21 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  33 */     String result_code = "0";
/*  34 */     RandomID randomID = new RandomID();
/*  35 */     String trade_id = randomID.GenOrderId();
/*  36 */     Tb_unionmodelinfo tb_unionmodelinfo = new Tb_unionmodelinfo();
/*     */ 
/*  38 */     DecimalFormat df = new DecimalFormat("0.00");
/*  39 */     double total_price = Double.parseDouble(map.getString("single_price")) * Integer.parseInt(map.getString("order_num"));
/*     */ 
/*  41 */     tb_unionmodelinfo.setTrade_id(trade_id);
/*  42 */     tb_unionmodelinfo.setOrder_no(map.getString("order_no"));
/*  43 */     tb_unionmodelinfo.setModel_id(map.getString("model_id"));
/*  44 */     tb_unionmodelinfo.setOrder_num(map.getInt("order_num"));
/*  45 */     tb_unionmodelinfo.setSingle_price(map.getString("single_price"));
/*  46 */     tb_unionmodelinfo.setTotal_price(df.format(total_price));
/*  47 */     tb_unionmodelinfo.setCust_id(map.getString("cust_id"));
/*  48 */     tb_unionmodelinfo.setUser_id(map.getString("user_id"));
/*  49 */     tb_unionmodelinfo.setRsrv_str1(map.getString("rsrv_str1"));
/*  50 */     tb_unionmodelinfo.setRsrv_str3(map.getString("rsrv_str3"));
/*  51 */     tb_unionmodelinfo.setRemark(map.getString("remark"));
/*     */     try
/*     */     {
/*  54 */       insert(dbmMgr, tb_unionmodelinfo);
/*     */     }
/*     */     catch (ApplicationException e)
/*     */     {
/*  58 */       e.printStackTrace();
/*  59 */       result_code = "1";
/*     */     }
/*     */ 
/*  62 */     map.setString("result_code", result_code);
/*     */ 
/*  64 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Tb_unionmodelinfo tb_unionmodelinfo)
/*     */     throws ApplicationException
/*     */   {
/*  73 */     dbmMgr.update("insertTb_unionmodelinfo", tb_unionmodelinfo);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  84 */     String pkid_string = map.getString("pkid");
/*  85 */     String result_code = "0";
/*     */     try {
/*  87 */       if (!pkid_string.equals("")) {
/*  88 */         String[] pkStr = pkid_string.split("\\|");
/*  89 */         for (int i = 0; i < pkStr.length; i++) {
/*  90 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  94 */       e.printStackTrace();
/*  95 */       result_code = "1";
/*     */     }
/*  97 */     map.setString("result_code", result_code);
/*  98 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 107 */     dbmMgr.update("deleteTb_unionmodelinfo", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 116 */     Tb_unionmodelinfo tb_unionmodelinfo = new Tb_unionmodelinfo();
/* 117 */     DecimalFormat df = new DecimalFormat("0.00");
/* 118 */     double total_price = Double.parseDouble(map.getString("order_num")) * Integer.parseInt(map.getString("single_price"));
/*     */ 
/* 120 */     tb_unionmodelinfo.setTrade_id(map.getString("trade_id"));
/* 121 */     tb_unionmodelinfo.setOrder_no(map.getString("order_no"));
/* 122 */     tb_unionmodelinfo.setModel_id(map.getString("model_id"));
/* 123 */     tb_unionmodelinfo.setOrder_num(map.getInt("order_num"));
/* 124 */     tb_unionmodelinfo.setSingle_price(map.getString("single_price"));
/* 125 */     tb_unionmodelinfo.setTotal_price(df.format(total_price));
/* 126 */     tb_unionmodelinfo.setCust_id(map.getString("cust_id"));
/* 127 */     tb_unionmodelinfo.setUser_id(map.getString("user_id"));
/* 128 */     tb_unionmodelinfo.setRemark(map.getString("remark"));
/*     */ 
/* 130 */     String result_code = "0";
/*     */     try {
/* 132 */       update(dbmMgr, tb_unionmodelinfo);
/*     */     } catch (ApplicationException e) {
/* 134 */       e.printStackTrace();
/* 135 */       result_code = "1";
/*     */     }
/* 137 */     map.setString("result_code", result_code);
/* 138 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Tb_unionmodelinfo tb_unionmodelinfo)
/*     */     throws ApplicationException
/*     */   {
/* 147 */     dbmMgr.update("updateTb_unionmodelinfo", tb_unionmodelinfo);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 157 */     Map tb_unionmodelinfo = (Hashtable)obj;
/* 158 */     if (start == 0)
/* 159 */       start = 0;
/*     */     else {
/* 161 */       start = (start - 1) * limit;
/*     */     }
/* 163 */     limit = start + limit;
/* 164 */     tb_unionmodelinfo.put("start", Integer.valueOf(start));
/* 165 */     tb_unionmodelinfo.put("end", Integer.valueOf(limit));
/*     */ 
/* 167 */     return this.queryList.getList("getListByTb_unionmodelinfoPage", tb_unionmodelinfo);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 178 */     Map tb_unionmodelinfo = (Hashtable)obj;
/*     */ 
/* 180 */     List list = this.queryList.getList("getCountByObjTb_unionmodelinfo", tb_unionmodelinfo);
/* 181 */     int count = 0;
/* 182 */     if ((list != null) && (list.size() > 0)) {
/* 183 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 184 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 185 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 188 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 198 */     return this.queryList.getList("getTb_unionmodelinfoByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getListByCust(String cust_id) {
/* 202 */     return this.queryList.getList("getTb_unionmodelinfoByCust", cust_id);
/*     */   }
/*     */ 
/*     */   public List getOrderModelByPk(Object obj) {
/* 206 */     Hashtable tb_unionmodelinfo = (Hashtable)obj;
/* 207 */     return this.queryList.getList("getOrderModelBypk", tb_unionmodelinfo);
/*     */   }
/*     */ 
/*     */   public List getOrderModelByOrder(String order_no) {
/* 211 */     return this.queryList.getList("getOrderModelByOrder", order_no);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.tb_unionmodelinfo.Tb_unionmodelinfoInfo
 * JD-Core Version:    0.6.0
 */